﻿<%@ Page Title="" Language="C#" MasterPageFile="~/adminpanel.master" AutoEventWireup="true" CodeFile="SubCategory.aspx.cs" Inherits="Web_SubCategory" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
        ClientIDMode="AutoID" DataSourceID="SqlDataSource1" 
    KeyFieldName="Cat_Name;Sub_Cat" Width="100%" 
        CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
        CssPostfix="BlackGlass" onrowvalidating="ASPxGridView1_RowValidating" >
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True">
                </EditButton>
                 <ClearFilterButton Visible="True">
                </ClearFilterButton>
                </dx:GridViewCommandColumn>
                 <dx:GridViewCommandColumn VisibleIndex="1">
                <NewButton Visible="True">
                </NewButton>
                </dx:GridViewCommandColumn>
                 <dx:GridViewCommandColumn VisibleIndex="2">
                <DeleteButton Visible="True">
                </DeleteButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataComboBoxColumn FieldName="Cat_Name" 
                VisibleIndex="3" Caption="Category Name">
                <PropertiesComboBox   TextField="Cat_Name" ValueField="Cat_Name" EnableSynchronization="False"
                    IncrementalFilteringMode="StartsWith" DataSourceID="SqlDataSource2">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataTextColumn FieldName="Sub_Cat" VisibleIndex="4" 
                Caption="Subcategory ID" >
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Sub_Cat_Name" VisibleIndex="5" 
                Caption="Subcategory Name">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="6" 
                Caption="Description">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn FieldName="Status" VisibleIndex="7" 
                Caption="Status">
                <PropertiesComboBox ValueField="Status" EnableSynchronization="False" IncrementalFilteringMode="StartsWith">
                    <Items>
                        <dx:ListEditItem Text="Show" Value="Show" />
                        <dx:ListEditItem Text="Hide" Value="Hide" />
                    </Items>
                    <ItemStyle Cursor="auto" />
                </PropertiesComboBox>
                <Settings FilterMode="DisplayText" />
            </dx:GridViewDataComboBoxColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />
        <SettingsPager PageSize="25">
        </SettingsPager>
        <Settings ShowFilterRow="True" />
        <Images SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css">
            <LoadingPanelOnStatusBar Url="~/App_Themes/BlackGlass/GridView/gvLoadingOnStatusBar.gif">
            </LoadingPanelOnStatusBar>
            <LoadingPanel Url="~/App_Themes/BlackGlass/GridView/Loading.gif">
            </LoadingPanel>
        </Images>
        <ImagesFilterControl>
            <LoadingPanel Url="~/App_Themes/BlackGlass/Editors/Loading.gif">
            </LoadingPanel>
        </ImagesFilterControl>
        <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
            CssPostfix="BlackGlass">
            <Header ImageSpacing="5px" SortingImageSpacing="5px">
            </Header>
        </Styles>
        <StylesEditors>
            <CalendarHeader Spacing="1px">
            </CalendarHeader>
            <ProgressBar Height="25px">
            </ProgressBar>
        </StylesEditors>
    </dx:ASPxGridView>
   
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
        
        
        SelectCommand="SELECT [Cat_Name], [Sub_Cat], [Sub_Cat_Name], [Description], [Status] FROM [Tbl_Sub_Category]" 
        DeleteCommand="DELETE FROM [Tbl_Sub_Category] WHERE [Sub_Cat] = @Sub_Cat" 
        InsertCommand="INSERT INTO [Tbl_Sub_Category] ([Cat_Name], [Sub_Cat], [Sub_Cat_Name], [Description], [Status]) VALUES (@Cat_Name, @Sub_Cat, @Sub_Cat_Name, @Description, @Status)" 
        UpdateCommand="UPDATE [Tbl_Sub_Category] SET [Cat_Name] = @Cat_Name, [Sub_Cat_Name] = @Sub_Cat_Name, [Description] = @Description, [Status] = @Status WHERE [Sub_Cat] = @Sub_Cat">
        <DeleteParameters>
            <asp:Parameter Name="Sub_Cat" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Cat_Name" Type="String" />
            <asp:Parameter Name="Sub_Cat" Type="String" />
            <asp:Parameter Name="Sub_Cat_Name" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Status" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Cat_Name" Type="String" />
            <asp:Parameter Name="Sub_Cat_Name" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Status" Type="String" />
            <asp:Parameter Name="Sub_Cat" Type="String" />
        </UpdateParameters>
        
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
        SelectCommand="SELECT [Cat_Name] FROM [Tbl_Category]">
    
    
    </asp:SqlDataSource>

</asp:Content>

